﻿<UserControl x:Class="KouDai.Phone.Views.CategoryView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:WpNext="clr-namespace:WPNextTools.NControls;assembly=WPNextTools"
             xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:vm="clr-namespace:KouDai.Phone.ViewModels"
             FontFamily="{StaticResource PhoneFontFamilyNormal}"
             FontSize="{StaticResource PhoneFontSizeNormal}"
             Foreground="{StaticResource PhoneForegroundBrush}"
             cal:Bind.AtDesignTime="True"
             d:DataContext="{d:DesignInstance IsDesignTimeCreatable=True,
                                              Type=vm:CategoryViewModel}"
             d:DesignHeight="800"
             d:DesignWidth="480"
             mc:Ignorable="d">

    <Grid x:Name="LayoutRoot">
        <WpNext:PhotoListBox x:Name="CategoryWall"
                             ItemsSource="{Binding CategoryItems}"
                             ScrollViewer.VerticalScrollBarVisibility="Hidden">
            <WpNext:PhotoListBox.StrategyDefinition>
                <WpNext:PhotoVirtualizationStrategyDefinition ColumnCount="2"
                                                              ColumnMargin="36"
                                                              LeftRightMargin="12"
                                                              Orientation="Vertical" />
            </WpNext:PhotoListBox.StrategyDefinition>
            <WpNext:PhotoListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Image Source="{Binding ImageUrl}" />
                        <TextBlock Margin="0,0,0,6"
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Bottom"
                                   FontSize="29.333"
                                   Foreground="{StaticResource HotListDarkBrush}"
                                   Text="{Binding ItemTagName}" />

                    </Grid>
                </DataTemplate>
            </WpNext:PhotoListBox.ItemTemplate>
            <!--
                <i:Interaction.Triggers>
                <i:EventTrigger EventName="ItemTap">
                <Command:EventToCommand Command="{Binding SecondLevelCategory}" CommandParameter="{Binding SelectedItem, ElementName=CategoryWall}" />
                </i:EventTrigger>
                </i:Interaction.Triggers>
            -->
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="ItemTap">
                    <cal:ActionMessage MethodName="SecondLevelCategory">
                        <cal:Parameter Value="{Binding SelectedItem, ElementName=CategoryWall}" />
                    </cal:ActionMessage>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </WpNext:PhotoListBox>
    </Grid>

</UserControl>